package com.wisecoach.gatewayplus.session;

import org.hyperledger.fabric.client.Gateway;

/**
 * Gateway的上下文
 * {@code @author:} wisecoach
 * {@code @date:} 2023/3/2 下午8:07
 * {@code @version:} 1.0.0
 */
public interface GatewayContext {
    /**
     * 取得当前的gateway
     */
    Gateway getGateway();

    /**
     * 设置当前的gateway
     */
    void setGateway(Gateway gateway);

    /**
     * 取得递归外层的老的Gateway
     */
    GatewayContext getOldGateway();

    /**
     * 设置递归外层的老的Gateway
     */
    void setOldGateway(GatewayContext oldGateway);

    /**
     * 清理gateway，如果gateway不为空，则会调用gateway.close()
     */
    void clearGateway();
}
